package com.platform.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.platform.entity.OrderGoodsEntity;
import com.platform.entity.ReturnEntity;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * Created by zhu.xiang on 2018/11/12 0012.
 */
@Data
public class OrderGoodsReturnDTO implements Serializable {
    private static final long serialVersionUID = 1L;

    public static final String PAY_TYPE_WX          =   "1";
    public static final String PAY_TYPE_COMMISSION  =   "2";

    //主键
    private Integer id;
    //订单序列号
    private String orderSn;
    //会员Id
    private Integer userId;
    //订单状态
    //订单相关状态字段设计，采用单个字段表示全部的订单状态
    //1xx 表示订单取消和删除等状态 0订单创建成功等待付款，　101订单已取消，　102订单已删除
    //2xx 表示订单支付状态　201订单已付款，等待发货
    //3xx 表示订单物流相关状态　300订单已发货， 301用户确认收货  302已完成
    //4xx 表示订单退换货相关的状态　401 没有发货，退款　402 已收货，退款退货
    private Integer orderStatus;
    //发货状态 商品配送情况;0未发货,1已发货,2已收货,4退货
    private Integer shippingStatus;
    //付款状态 支付状态;0未付款;1付款中;2已付款
    private Integer payStatus;
    //收货人
    private String consignee;
    //国家
    private String country;
    //省
    private String province;
    //地市
    private String city;
    //区县
    private String district;
    //收货地址
    private String address;
    //联系电话
    private String mobile;
    //补充说明
    private String postscript;
    //快递公司Id
    private Integer shippingId;
    //快递公司名称
    private String shippingName;
    //快递单号
    private String shippingNo;
    //付款
    private String payId;
    //
    private String payName;
    //快递费用
    private BigDecimal shippingFee;
    //发货时间
    private Date shippingTime;
    //实际需要支付的金额
    private BigDecimal actualPrice;
    //
    private Integer integral;
    //
    private BigDecimal integralMoney;
    //订单总价
    private BigDecimal orderPrice;
    //商品总价
    private BigDecimal goodsPrice;
    //新增时间
    private Date addTime;
    //确认时间
    private Date confirmTime;
    //付款时间
    private Date payTime;
    //配送费用
    private Integer freightPrice;
    //使用的优惠券id
    private Integer couponId;
    //
    private Integer parentId;
    //优惠价格
    private BigDecimal couponPrice;
    //
    private String callbackStatus;

    //订单类型 1：普通订单 2：团购订单 3：砍价订单 4: 直接购买
    private String orderType;

    //支付类型 1微信 2佣金
    private String payType;

    //
    private String userName;

    //订单Id
    private Integer orderId;
    //商品id
    private Integer goodsId;
    //商品名称
    private String goodsName;
    //商品序列号
    private String goodsSn;
    //产品Id
    private Integer productId;
    //商品数量
    private Integer number;
    //市场价
    private BigDecimal marketPrice;
    //零售价格
    private BigDecimal retailPrice;
    //成本价
    private BigDecimal costPrice;
    //折扣价
    private BigDecimal discountPrice;
    //实际折扣
    private BigDecimal actualDiscountPrice;
    //商品规格详情
    private String goodsSpecifitionNameValue;
    //虚拟商品
    private Integer isReal;
    //商品规格Ids
    private String goodsSpecifitionIds;
    //图片链接
    private String listPicUrl;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date returnApplyTime;
    private Integer returnNumber;

    //1 退货中 2 退款中
    private String returnType;
    private Integer isReturn;
    private String returnReasonCode;
    private String returnReasonDesc;
    private String returnRemark;
    private String returnPic1Url;
    private String returnPic2Url;
    private String returnPic3Url;
    private String returnPic4Url;
    private String returnPic5Url;
    private String returnPic6Url;
    private Integer returnShippingId;
    private String returnShippingCode;
    private String returnShippingName;
    private String returnShippingNo;
    private String returnShippingAddress;
    private String returnShippingConsignee;
    private String returnShippingMobile;
    //1 处理中 2 已关闭
    private String returnStatus;
    private String returnAuditStatus;
    private String returnAuditRemark;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date returnAuditTime;

    public String getReturnTypeDesc(){
        if (returnType == null) return "";
        if (returnType.equals(ReturnEntity.TYPE_RG)) return "退货";
        if (returnType.equals(ReturnEntity.TYPE_RM)) return "退款";
        return "";
    }

    public String getReturnStatusDesc(){
        if (returnStatus == null) {
            return "";
        } else if (returnStatus.equals(ReturnEntity.STATUS_DEAL)){
            return "处理中";
        } else {
            return "已关闭";
        }

    }

    public String getReturnAuditStatusDesc(){
        if (returnAuditStatus == null) {
            return "";
        } else if (returnAuditStatus.equals(ReturnEntity.AUDIT_STATUS_INIT)){
            return "待审核";
        } else if (returnAuditStatus.equals(ReturnEntity.AUDIT_STATUS_PASS)) {
            return "审核通过";
        } else {
            return "审核不通过";
        }

    }
}
